package yyx;

public class City{
	String name;
	int population;
	double taxRate;
	int defense;
	
	public City(String name,int population,double taxRate,int defense) {
		this.name = name;
		this.population = population;
		this.taxRate = taxRate;
		this.defense = defense;
	}
	
	public void showInfo() {
		System.out.println("该城市的名称为"+name);
		System.out.println("该城市的人口数量为"+population);
		System.out.println("该城市的税率为"+taxRate);
		System.out.println("该城市的防御力为"+defense);
	}
	
	public void updatePopulation() {
		int 幸福度 = 100- (int)(this.taxRate * 100);
		if(幸福度 > 80) {
			System.out.println("这城市未来人口增加到"+(this.population*1.05)+"万人");
		}
		else if(幸福度 < 60) {
			System.out.println("这城市未来人口将减少为"+(this.population*0.95)+"万人");
		}
		else {
			System.out.println("这城市未来人口可能没啥变化");
		}
	}
	
	public void adjustTaxRate() {
		int 幸福度 = 100- (int)(this.taxRate * 100);
		if(幸福度 > 80) {
			System.out.println("这城市税率将调整为"+0.20);
			this.taxRate = 0.2;
		}
		else if(幸福度 < 60) {
			System.out.println("这城市税率将调整为"+0.10);
			this.taxRate = 0.1;
		}
		else {
			System.out.println("这城市税率暂时不变化");
		}
	}
}